home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group99a.txt
/
000225_icon-group-sender _Wed Oct 27 07:57:44 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id HAA09494
for icon-group-addresses; Wed, 27 Oct 1999 07:57:38 -0700 (MST)
Message-Id: <199910271457.HAA09494@baskerville.CS.Arizona.EDU>
From: gep2@terabites.com
Date: Wed, 27 Oct 1999 01:43:11 -0500
Subject: csets and sets of characters
To: icon-group@optima.CS.Arizona.EDU
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
> In writing an Icon version of a command line options parser,
like getopt() in C & Perl, I decided to first convert the input
string of option characters (ie. "abc:12:") into two sets of
characters, one for options that take arguments, and one for
options which take no arguments. This is easy using Icon sets,
but it seems more natural somehow to use the built-in cset
datatype. But I don't see how to test for members in csets
(member( 'abc', "b" ) generates a run time error). Any sage
advice out there about when to use sets and/or csets?
It SOUNDS like you're trying to write it the way you'd write it in C or Perl,
and that's usually a bad sign.
Usually what I think you really want to do is instead to use string scanning to
process your options. This might be very different of course depending on just
what you're trying to do, but I'd think you'd want something more based on
something like
tab(any(noargparms) | (any(argparms) many("0123456789")))
Sorry to not provide a more concrete example, but it really does depend on just
what you're trying to accomplish... and what you want your command line to look
like.
Gordon Peterson
http://web2.airmail.net/gep2/
Support the Anti-SPAM Amendment! Join at http://www.cauce.org/
12/19/98: the day the Conservatives demonstrated their scorn for their
fraudulent sham of representative government. Voters, remember it!